<?php
class sis_anggota_history_model extends MY_Model {
	var $model = 'sis_anggota_history';
	
	function Add($arr_data){
		$this->db->insert('SIS_ANGGOTA_HISTORY', $arr_data);
	}
	
	function Update($arr_data, $arr_rule){
		$this->db->update('SIS_ANGGOTA_HISTORY', $arr_data, $arr_rule);
	}
	
	function GetSingle($as_personid, $an_nourut){
		$result = $this->db->get_where('SIS_ANGGOTA_HISTORY', array('PERSON_ID' => $as_personid, 'NO_URUT' => $an_nourut));
		if($result->num_rows() == 1){
			return $result->row_array();
		}else{
			return NULL;
		}
	}
	
	function GetSingleView($as_personid, $an_nourut)
	{
		$result = $this->db->get_where('SIS_ANGGOTA_HISTORY', array('PERSON_ID' => $as_personid, 'NO_URUT' => $an_nourut));
		if($result->num_rows() == 1){
			return $result->row_array();
		}else{
			return NULL;
		}
	}

	function DeleteSingle($arr_rule)
	{
		try {
			$this->db->delete('SIS_ANGGOTA_HISTORY', $arr_rule);
			return '';
		} catch(Exception $e) {
			return $e->getMessage();
		}
	}
}
?>